** "The Supreme Court, Ideology, and the Decision to Cite or Borrow from Amicus Curiae Briefs" American Politics Research 

** Note you will need to install Gary King's relogit available here : https://gking.harvard.edu/relogit
** Analyses performed in Stata/MP 15.1 for Mac (64-bit Intel)

** CITATIONS MAIN ARTICLE 
	cd /Users/user/Desktop/ 
	use "APR_Cites.dta"


** FIGURE 1 
	kdensity meanideoonly, bwidth(.3) lc(black) lp(solid) plot(kdensity meanideoonly if poscited==1, bwidth(.3) lc(black) lp(dash) graphregion(fcolor(white)) ytitle("Kernal Density of Mean Ideology") legend(label(1 "Ideology of all amici") label(2 "Ideology of Amici Whose Briefs were Cited"))) 
** TABLE 1 MODEL 1
	relogit poscited ideoovert ff99 ussgfiled numamici numbriefs opincountscaled earlysalienceest reverse owidealpoint, cluster(uscite)

** TABLE 1 MODEL 2
	relogit poscited ideobriefcoarse ff99 ussgfiled numamici numbriefs opincountscaled earlysalienceest reverse owidealpoint, cluster(uscite)

** TABLE 1 MODEL 3
	relogit poscited congoa ff99 ussgfiled numamici numbriefs opincountscaled earlysalienceest reverse , cluster(uscite)

** TABLE 1 MODEL 4
	relogit poscited ideocongcoarse ff99 ussgfiled numamici numbriefs opincountscaled earlysalienceest reverse owidealpoint, cluster(uscite)


** BORROWED LANGUAGE ANALYSIS MAIN ARTICLE 
	cd /Users/user/Desktop/ 
	use "APR_Borrows.dta"

** TABLE 2 MODEL 1
		glm BorrFrac CongOA FF99p LitigantOverlap OpinCountScaled USSGFiled NumAmici NumBriefs earlysalienceest Reverse if NoIdeo==0, cluster(uscite) family(binomial) link(logit)

** TABLE 2 MODEL 2
		glm BorrFrac CongMedMC FF99p LitigantOverlap OpinCountScaled USSGFiled NumAmici NumBriefs earlysalienceest Reverse if NoIdeo==0 & decisionType!=6, cluster(uscite) family(binomial) link(logit)

** FIGURE 2: KDP Plot
	kdensity MeanIdeoOnly, bwidth(.3) lc(black) lp(solid) plot(kdensity MeanIdeoOnly if BorrOpin>=5, bwidth(.3) lc(black) lp(dash)graphregion(fcolor(white))ytitle("Kernal Density of Mean Ideology") legend(label(1 "Ideology of all amici") label(2 "Ideology of Amici Whose Briefs were Borrowed (5%+)")))



*** ONLINE APPENDIX
** CITATIONS 
	use  "APR_Cites.dta"
	
** Table OA1: Citations models without the frequent filer variable
	** Model 1
	relogit poscited ideoovert ussgfiled numamici numbriefs opincountscaled earlysalienceest reverse owidealpoint, cluster(uscite)
 
	** Model 2
	relogit poscited ideobriefcoarse ussgfiled numamici numbriefs opincountscaled earlysalienceest reverse owidealpoint, cluster(uscite)
	
	** Model 3
	relogit poscited congoa ussgfiled numamici numbriefs opincountscaled earlysalienceest reverse , cluster(uscite)

	** Model 4	
	relogit poscited ideocongcoarse ussgfiled numamici numbriefs opincountscaled earlysalienceest reverse owidealpoint, cluster(uscite)


** Table OA2: Citations models with issue area controls
	** Model 1
		relogit poscited ideoovert ff99 ussgfiled numamici numbriefs opincountscaled earlysalienceest reverse owidealpoint CivRights EconAct Federalism FirstAmend Unions, cluster(uscite)
	
	** Model 2
		relogit poscited ideobriefcoarse ff99 ussgfiled numamici numbriefs opincountscaled earlysalienceest reverse owidealpoint CivRights EconAct Federalism FirstAmend Unions, cluster(uscite)

	** Model 3
		relogit poscited congoa ff99 ussgfiled numamici numbriefs opincountscaled earlysalienceest reverse owidealpoint CivRights EconAct Federalism FirstAmend Unions, cluster(uscite)
	
	** Model 4
		relogit poscited ideocongcoarse ff99 ussgfiled numamici numbriefs opincountscaled earlysalienceest reverse owidealpoint CivRights EconAct Federalism FirstAmend Unions, cluster(uscite)

** BORROWS
	use "APR_Borrows.dta"
	
** Table OA3 Fractional Logit Models with Fixed Effects for Justice and Term 
	** Model 1
		glm BorrFrac CongOA FF99p LitigantOverlap OpinCountScaled USSGFiled NumAmici NumBriefs earlysalienceest Reverse i.justice i.term if NoIdeo==0, cluster(uscite) family(binomial) link(logit)
	** Model 2
		glm BorrFrac CongMedMC FF99p LitigantOverlap OpinCountScaled USSGFiled NumAmici NumBriefs earlysalienceest Reverse i.justice i.term if NoIdeo==0 & decisionType!=6, cluster(uscite) family(binomial) link(logit)

** Table OA4: Borrowed Model Controlling for issue area 
		glm BorrFrac CongOA FF99p LitigantOverlap OpinCountScaled USSGFiled NumAmici NumBriefs earlysalienceest Reverse i.issueArea if NoIdeo==0, cluster(uscite) family(binomial) link(logit)

** Table OA5: Issue area with only unions and federalism 
		glm BorrFrac CongOA FF99p LitigantOverlap OpinCountScaled USSGFiled NumAmici NumBriefs earlysalienceest Reverse Unions Federalism if NoIdeo==0, cluster(uscite) family(binomial) link(logit)

		
